package com.comleader.operator.core.exception;

import static com.comleader.operator.common.response.ResultEnum.ERROR;
import static com.comleader.operator.common.response.ResultEnum.FAILED;

import com.comleader.operator.common.response.ResultEnum;

import lombok.Getter;

/**
 * 功能描述: 业务异常类
 * 
 * @Param:
 * @Author: 连新景
 * @Date: 2024/7/10 15:36
 */
@Getter
public class BusinessException extends RuntimeException {
    private static final long serialVersionUID = 1L;

    /**
     * 错误码
     */
    private Integer code;

    public BusinessException(String message) {
        super(message);
        this.code = FAILED.getCode();

    }

    public BusinessException(ResultEnum resultEnum) {
        super(resultEnum.getMsg());
        this.code = resultEnum.getCode();

    }

    public BusinessException(Throwable throwable) {
        super(ERROR.getMsg(), throwable);
        this.code = ERROR.getCode();

    }

}
